﻿@using core6_website.Models.EnumTypes
@model  Student
@inject IStudentRepo _studentRepo

@{
    ViewBag.Title = "创建学生信息";
}

<form asp-controller="home"
      asp-action="create"
      method="post"
      class="mt-3">

    <span asp-validation-summary="All" class="text-danger"></span>

    <div class="form-group row">
        <label asp-for="Name" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <input asp-for="Name" class="form-control" placeholder="输入名字" />
            <span asp-validation-for="Name"
                  class="text-danger"></span>
        </div>
    </div>
    <div class="form-group row">
        <label asp-for="Email" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <input asp-for="Email" class="form-control" placeholder="输入邮箱" />
            <span asp-validation-for="Email"
                  class="text-danger"></span>
        </div>
    </div>
    <div class="form-group row">
        <label asp-for="Major" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <select asp-for="Major"
                    class="custom-select mr-sm-2"
                    asp-items="Html.GetEnumSelectList<MajorEnum>()">
                <option value="">请选择</option>
            </select>
            <span asp-validation-for="Major" class="text-danger"></span>
        </div>
    </div>

    <div class="form-group row">
        <div class="col-sm-10">
            <button type="submit" class="btn btn-primary">创建</button>
        </div>
    </div>


    <div class="form-group row">
        <div class="col-sm-10">
            学生总人数：@_studentRepo.GetAllStudents().Count().ToString()
        </div>
    </div>
</form>